package com.oocl.homework.crm.command;

import com.oocl.homework.crm.datastruct.Executeable;
import com.oocl.homework.crm.model.Filterable;

public class QuitCommand<T> extends Command<T> {

	public QuitCommand(String command) {
		super(command);
	}
	
	@Override
	public void filter(Filterable filterable) {
		if (!command.equals("Q")) {
			result.setCode(-1);
			result.setMessage("Unrecognized command:"+command);
		}
	}
	
	@Override
	public void executeCommand(Executeable<T> executeable, T t) {
			System.out.println("system exit!");
			System.exit(0);
	}
	
	@Override
	public void display() {
		super.display();
		CommandDoc.printQuitCommandHelp();
	}

}
